import requests
from lxml import etree
import re
import json
if __name__ == '__main__':
    url = 'https://www.pearvideo.com/'
    headers = {
        'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54'
    }
    page_text = requests.get(url=url,headers=headers).text
    tree = etree.HTML(page_text)
    video_url_list = tree.xpath('//*[@id="vervideoTlist"]/div/ul[1]/li')
    for li in video_url_list:
        detial_url = 'https://www.pearvideo.com/'+li.xpath('./div/a/@href')[0]
        video_title = li.xpath('./div/a/div[2]/div[2]/text()')[0]
        print(video_title,detial_url)
        data = {
            'contId':'1728850',
            'mrd':'0.8385624029239964',
        }
        video_url_text = requests.get(url=detial_url,params=data,headers=headers)
        video_data = video_url_text.json()